﻿using CommunityToolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
using Wpf.Ui.Controls;
using WpfMvvmTemplate.WPFUI.Common;

namespace WpfMvvmTemplate.WPFUI.Models.Windows
{
    public partial class MainWindowModel : ObservableObject
    {
        [ObservableProperty]
        private string applicationTitle;

        [ObservableProperty]
        private ObservableCollection<object> menuItems;

        [ObservableProperty]
        private ObservableCollection<object> footerMenuItems;

        [ObservableProperty]
        private ObservableCollection<MenuItem> trayMenuItems = new()
        {
            new MenuItem { Header = "Home", Tag = "tray_home" }
        };

        public MainWindowModel()
        {
            ApplicationTitle = "Liu Chao - WpfMvvmTemplate.WPFUI";

            //是否是设计时，设计时无法加载静态资源 GlobalStaticData.LanguageDic
            bool temp = DesignerProperties.GetIsInDesignMode(new DependencyObject());

            MenuItems = new()
            {
                new NavigationViewItem()
                {
                    Content = temp ? "主页" : GlobalStaticData.LanguageDic["Home"],
                    Icon = new SymbolIcon { Symbol = SymbolRegular.Home24 },
                    TargetPageType = typeof(Views.Pages.DashboardPage)
                },
                new NavigationViewItem()
                {
                    Content = temp ? "数据" : GlobalStaticData.LanguageDic["Data"],
                    Icon = new SymbolIcon { Symbol = SymbolRegular.DataHistogram24 },
                    TargetPageType = typeof(Views.Pages.DataPage)
                },
                new NavigationViewItem()
                {
                    Content = "测试123",
                    Icon = new SymbolIcon { Symbol = SymbolRegular.DataHistogram24 },
                    TargetPageType = typeof(Views.Pages.DataPage),
                    MenuItems = new object[]
                    {
                        new NavigationViewItem("1", SymbolRegular.TextFont24, typeof(Views.Pages.DashboardPage)),
                        new NavigationViewItem("2", SymbolRegular.Diversity24, typeof(Views.Pages.DataPage)),
                        new NavigationViewItem("3", SymbolRegular.Color24, typeof(Views.Pages.DashboardPage))
                    }
                }
            };

            FooterMenuItems = new()
            {
                new NavigationViewItem()
                {
                    Content = temp ? "设置" : GlobalStaticData.LanguageDic["Settings"],
                    Icon = new SymbolIcon { Symbol = SymbolRegular.Settings24 },
                    TargetPageType = typeof(Views.Pages.SettingsPage)
                }
            };

        }

    }
}
